<?php
error_reporting(0);
session_start();
include_once '../comm/config.php';
include_once 'page.class.php';
include_once '../comm/checkpostandget.php';
include_once '../comm/wjt.php';
include_once 'check.php';

$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$page2=($page-1)*$pagesize;
$txxz=TXXZ;
if($txxz=='TXXZ'){$txxz=0;}

$sql="select zfb,tbusername,money,mobile,txstate from ".$BIAOTOU."user where Id=".$_SESSION['dduserid']; 
$rs = mysql_query($sql);
while ($row = mysql_fetch_array($rs)){
	$zfb=$row["zfb"]; 
	$realname=$row["tbusername"];
	$money=$row["money"];
	if($money<=0){
		echo "<script language=javascript>alert('您的金额为0，不能申请提现！');window.location='center.php';</script>";
		exit;
	}
	$mobile=$row["mobile"];
	$txstate=$row["txstate"];
	if($txstate=='1'){
		echo "<script language=javascript>window.location='error1.php?id=12';</script>";
		exit;
	}
}

$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>申请提现 - 用户中心</title>

<link href="../template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript" type="text/javascript">
function checktxje()
{
		var str1 = parseFloat(document.getElementById("txje").value); 
		var str2 = parseFloat(document.getElementById("ktx").value);    
        if(str1.length!=0)
		{     
			if(str1>str2)
			{    
				document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>金额不能大于可提现金额</font>';
				return false;
			}
			else if(str1<=0){
			    document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>提现金额大于0</font>';
				return false;
			}
			else
			{
				<?php
				if($txxz!='0'){
				?>
				if(str1%<?=$txxz?>!=0){
					document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>金额只能是<?=$txxz?>或<?=$txxz?>的倍数</font>';
					return false;
				}else{
					document.getElementById("cktxje").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>提现金额正确</font>';
					return true;
				}
				<?php
				}else{
				?>
					document.getElementById("cktxje").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>提现金额正确</font>';
					return true;
				<?php }?>
			}
		}
		else
		{
				document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写提现金额</font>';
				return false;
		}
}   
function checkzfb1()
{
		var str = document.getElementById("zfb1").value;    
        if(str.length==0)
		{    
			document.getElementById("ckzfb1").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
			return false;
		}
		else
		{
			document.getElementById("ckzfb1").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝填写正确</font>';
			return true;		
		}
}
		
function checkzfb2()
{
		var str1 = document.getElementById("zfb1").value;
		var str2 = document.getElementById("zfb2").value;    
        if(str2.length!=0)
		{    
			if(str1!=str2)
			{    
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>两次支付宝填写不一样，请检查</font>';
				return false;
			}
			else
			{
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝确认正确</font>';
				return true;
			}
		}
		else
		{
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
				return false;
		}
} 
function checkpass()
{
	var password = document.getElementById("password").value;    
    	if(password.length==0)
		{
			document.getElementById("ckpassword").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请输入密码</font>';
			return false;
		}
		else
		{
			document.getElementById("ckpassword").innerHTML = '';
			return true;
		}
}
function checkall()
{
	if(!checktxje()||!checkzfb1()||!checkzfb2()||!checkpass())
	{
		return false;
	}
	else
	{
		return true;
	}
}
</script>
</head>
<?php
$modtag="mng";
include("../template/".MOBAN."/header_user.tpl.php");
?>


<div class="layout_body">

  <div class="uInfoTop">
     <div class="break"><a href="javascript:void();" onclick="javascript:window.history.back();"><img src="../template/<?=MOBAN?>/images/back.gif" width="29" height="30" border="0" /></a></div>
     <div class="username usernamefont"><?=$_SESSION["duoduouser"]?></div>
     <div class="userstate"><a class="ustatefont" href="exit.php">退出</a></div>
  </div>
  <div class="usertopline"></div>

  <div class="clears"></div>
  <div class="CreatL" style="width:160px">
    <ul>
      <li class="UserSel"><a href="mingxilist.php?act=in">账户明细</a></li>
      <li><a href="avatar.php"> 头像设置</a></li>
      <li><a href="setpass.php">密码设置</a></li>
      <li><a href="info.php">个人信息设置</a></li>
    </ul>
  </div>
  <div class="CreatR">
      <ul class="babydetail MarginB10">
        <li><a href="mingxilist.php?act=in">我的收入明细</a></li>
        <li><a href="mingxilist.php?act=tui">我的退款明细</a></li>
        <li><a href="mingxilist.php?act=out">我的提现明细</a></li>
        <li class="active"><a href="tixian.php">申请提现</a></li>
      </ul>
      <div class="clears"></div>
      <div class=" clears"></div>
  </div> 
  <form id="form1" name="form1" method="post" action="tixian_save.php" onsubmit="return checkall()">
  <div class="userinfo">
     <?php if($money<TIXIANJE){?>
     <!--金额不足-->
     <div class="line" style="height:110px;margin-left:0px">
        <div  class="ts" style="height:110px">
        	<div class="l1 tfont2">您当前可提现<?=$money?>元，还差<?=TIXIANJE-$money?>元就可以提现了</div>
            <div class="l1 tfont1" style="margin-top:5px">注意事项：</div>
            <div class="l1 tfont2">当您帐户金额达到<?=TIXIANJE?>米时就可以申请提现了，提现金额必须是10或者10的倍数。</div>        
            <div class="l1 tfont2">提交提现申请后，我们会在1个工作日内把钱通过支付玉支付到您填写的支付宝收款帐号里。</div>        
            <div class="l1 tfont2">便于核对帐号，请留真实姓名。</div>        
        </div>
     </div>
     <?php }else{?>
     <!--说明信息-->
     <div class="line" style="height:50px;margin-left:0px">
        <div  class="ts">
        	<div class="l1 tfont1" style="margin-top:5px">提示信息</div>
            <div class="l1 tfont2">在您提出提现的24小时内，我们将返现金额直接支付到您提供的支付宝账号中，请注意查收！</div>
        </div>
     </div>
     <div class="line" style="margin-top:15px">
       <div class="cp">可提现金额：</div> 
       <div class="cp tfont3" style="width:auto;text-align:left"><?php echo $money?> </div>
       <input type="hidden" name="ktx" id="ktx" value="<?php echo $money?>" />
       <div class="cp" style="width:auto;text-align:left"> 元</div>
     </div>
     <div class="line" style="width:760px">
        <div class="cp">申请提现：</div> 	
        <div class="edit"><input name="txje" id="txje" type="text" size="15" maxlength="10" value="<?php if($txxz!='0'){echo ($money/$txxz)*$txxz;}else{echo $money;}?>" onblur="checktxje();" class="mytxt"/></div>
        <div class="hint" style="width:340px" id="cktxje">请填写，金额大于<font class="tfont3"><?php echo TIXIANJE?></font>元，小于<font class="tfont3"><?php echo $money?></font>元<?PHP if($txxz!='0'){?>，且须是<font class="biggreentext"><?=$txxz?></font>的倍数<?php }?></div>    
    </div>
    <div class="line">
        <div class="cp">支付宝账号：</div> 
     	<div class="edit"><input type="text" name="zfb1" id="zfb1" onblur="checkzfb1();" value="<?php echo $zfb?>" <?php if ($zfb!=""){ echo "readonly";}?> class="mytxt" /></div>
        <div class="hint" id="ckzfb1">请正确填写支付宝账号，填写后不可修改</div>  
     </div>  
     <div class="line">
        <div class="cp">手续费：</div> 	
        <div class="edit" style="line-height:35px">0米</div>
        <div class="hint" id="ckzfb2">请再次确认支付宝账号，填写后不可修改</div>
    </div>
    <div class="line">
        <div class="cp">收款人姓名：</div> 
     	<div class="edit"><input name="realname" id="realname" type="text" value="<?php echo $realname?>" <?php if ($realname!=""){ echo "readonly";}?> class="mytxt" /></div>
        <div class="hint">转账核对时用，填写后不可修改(与支付宝对应)</div> 
     </div>  
     <div class="line">
        <div class="cp">手机号：</div>
     	<div class="edit"><input name="mobile" id="mobile" type="text" value="<?php echo $mobile?>" class="mytxt" /></div>
 		<div class="hint">选填</div>    
     </div> 
     <div class="line">
        <div class="cp">优米库登录密码：</div>
     	<div class="edit"><input name="password" id="password" type="password" onblur="checkpass();" class="mytxt" /></div>
 		<div class="hint" id="ckpassword">本站登录密码，校对用，必须填写</div>    
     </div>      
     <div class="line" style="margin-top:20px">
       <input type="submit" value="申请提现" class="divbutton" style="height:40px;width:150px;margin-left:100px;display:inline" />
     </div>
     <?php }?>
  </div>
  </form>
</div>
 
<div class="lineclear" style="margin-top:50px"></div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
</body>
</html>
